package cn.juan.day2homework;

import java.util.Scanner;

public class SuperWorker extends day2homework{
    private float bonus;



    public float getBonus() {
        return bonus;
    }

    public void setBonus(float bonus) {
        this.bonus = bonus;
    }

    public SuperWorker(String name, String job, int salary) {
        super(name, job, salary);
    }

    @Override
    public int dojob(int months) {
        return (int) (super.dojob(months)*(1+this.bonus));
    }

    public int dojob(int months,int addtionalHours) {
        return (int) (super.dojob(months)+(bonus*getSalary()*addtionalHours)/100);
    }

    public static void main(String[] args) {
        SuperWorker superWorker = new SuperWorker("李四","前端",3000);
        Scanner in =new Scanner(System.in);
        System.out.println("输入奖金系数0-1");
        boolean isfasle=true;
        float bonus=in.nextFloat();
        while (isfasle){
            if (bonus>0&bonus<1) {
                isfasle = false;
            }
            else
            {System.out.println("格式有误重新输入！！");}
        }
        superWorker.setBonus(bonus);
        System.out.println(superWorker.dojob(3));
        System.out.println(superWorker.dojob(3,2));
        return;

    }
}
